﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.XPath;
using ClassLibrary1;

namespace Hades.StaticContentManager
{
    public class StaticContentManager : IContentManager
    {
        /// <summary>
        /// Funcion que carga un diccionario con las llaves traidas desde el .xml
        /// </summary>
        /// <param name="domain">dominio</param>
        /// <returns>diccionario con las llaves</returns>
        public Dictionary<string, string> GetAll(string domain)
        {
            try
            {
                //Archivo Cargado
                XElement element = XElement.Load(ConfigurationManager.AppSettings["FilesPath"]);                
                Dictionary<string, string> configDictionary = new Dictionary<string, string>();
                configDictionary = element.Elements().ToDictionary(x => x.Attribute("name").Value, y => y.Value);
                return configDictionary;
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}
